<?php
/**
 * this Dig_Application_Resource_Interface application resource
 * configures the site layout
 *
 */
class Dig_Application_Resource_Ui extends Zend_Application_Resource_ResourceAbstract
{
    protected $_scope = 'public';
    public function init ()
    {
        $options = $this->getOptions();
        // set up the view
        $view = $this->getBootstrap()->getResource('view');
        $view->addHelperPath('Dig/View/Helper', 'Dig_View_Helper');
        $view->setFilterPath('Dig/View/Filter');
        // pass the ui options to zend layout
        $layoutOptions = isset($options['layoutOptions']) ? $options['layoutOptions'] : null;
        $layout = Zend_Layout::startMvc($layoutOptions);
        $layout->assign('digitalusOptions', $options);
        /**
         * register the layout controller plugin. you need to use a plugin
         * because you need the controller to route the request before you 
         * can determine what layout to use
         * 
         */
        $front = $this->getBootstrap()->getResource('FrontController');
        $front->registerPlugin(new Dig_Controller_Plugin_Layout());
    }
}
 